<%@ page import="com.onlinevideo.entity.Comment" %>
<%@ page import="java.util.List" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>评论审核</title>
    <link href="../static/css/bootstrap.min.css" rel="stylesheet">
    <link href="../static/css/bootstrap-theme.min.css" rel="stylesheet">
    <script src="../static/js/jquery-1.11.3.min.js" type="text/javascript"></script>
    <script src="../static/js/bootstrap.min.js" type="text/javascript"></script>
    <script src="../static/js/sweetalert.min-2.1.2.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {

            $(".pass").click(function () {
                var commentId = $(this).attr("data-id");
                $.ajax({
                    url:"../comment.do",
                    type:"GET",
                    data:{
                        action:"checkComment",
                        commentId:commentId,
                        delete:"false"
                    },
                    success:function (data) {
                        var result = JSON.parse(data)
                        window.location.reload()
                        swal("提示", result.message, "success").then(function (isOk) {});
                    }
                });
            });
            $(".delete").click(function () {
                var commentId = $(this).attr("data-id");
                $.ajax({
                    url:"../comment.do",
                    type:"GET",
                    data:{
                        action:"checkComment",
                        commentId:commentId,
                        delete:"true"
                    },
                    success:function (data) {
                        var result = JSON.parse(data)
                        window.location.reload()
                        swal("提示", result.message, "success").then(function (isOk) {});
                    }
                });
            });
        });
    </script>
</head>
<body>
<div class="container">
    <div class="row">
        <div class="bs-example" data-example-id="btn-variants">

        </div>
    </div>
    <div class="row">
        <div class="col-md-12">
            <table class="table table-striped" style="margin-bottom: 0;width: 80%">
                <thead>
                <tr style="text-align: center ; vertical-align:center;">
                    <th>编号</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <%

                    List<Comment> comments = (List<Comment>)request.getAttribute("comments");
                    for (Comment comment : comments) {
                %>
                <tr style="height: 100px ;vertical-align:middle;text-align: center">
                    <th><%= comment.getCommentContent()%>
                    </th>
                    <th>
                        <button type="button" class="btn btn-primary btn-sm editInfo pass" data-toggle="modal"
                                data-id="<%=comment.getId() %>" data-target="#editCategoryBtn">通过
                        </button>
                        <button type="button" class="btn btn-danger  btn-sm delete" data-id="<%=comment.getId()%>">删除</button>
                    </th>
                </tr>
                <%
                    }
                %>
                </tbody>
            </table>
        </div>
    </div>
</div>
</body>
</html>
